home *** CD-ROM | disk | FTP | other *** search
- /*
- * Libraries and headers for PDC release 3.3 (C) 1989 Lionel Hummel.
- * PDC Software Distribution (C) 1989 Lionel Hummel and Paul Petersen.
- * PDC I/O Library (C) 1987 by J.A. Lydiatt.
- *
- * This code is freely redistributable upon the conditions that this
- * notice remains intact and that modified versions of this file not
- * be included as part of the PDC Software Distribution without the
- * express consent of the copyright holders. No warrantee of any
- * kind is provided with this code. For further information, contact:
- *
- * PDC Software Distribution Internet: BIX:
- * P.O. Box 4006 or hummel@cs.uiuc.edu lhummel
- * Urbana, IL 61801-8801 petersen@uicsrd.csrd.uiuc.edu
- */
-
- /*
- * stdio.h
- *
- * 02.3.91 sjw; use K&R2 prototypes
- * 17.3.91 sjw; move fdopen(), fileno() to unix.h
- * 15.7.91 sjw; move them back again.
- */
-
- #ifndef __STDIO_H__
- #define __STDIO_H__
-
- /* - bit of efficiency here - */
-
- #ifndef __STDDEF_H__
- #include <stddef.h>
- #endif
-
- #ifndef __STDARG_H__
- #include <stdarg.h>
- #endif
-
- struct _iobuf {
- struct _iobuf *next; /* Link to next buffer in chain */
- int _fileunit; /* File descriptor */
- char *_filecpos; /* Current position in buffer */
- char *_fileend; /* Last position in buffer */
- long _filelen; /* Buffer size */
- char *_filebufp; /* za buffer */
- char _filebyte; /* Instant one-byte buffer */
- char _padbyte;
- unsigned short _fileflag; /* Condition flags */
- };
-
- #define FILE struct _iobuf
- extern FILE _fdevtab[];
-
- #define BUFSIZ (1024)
- #define MAX_READ_SIZE (1024)
-
- #define _FILEACTIVE 0x01
- #define _FILEISDIRTY 0x02
- #define _FILEATEOF 0x04
- #define _FILEBAD 0x08
- #define _FILEISDYNA 0x10
- #define _FILEISTTY 0x20
-
- #define _IOREAD 0x1
- #define _IOWRT 0x2
- #define _IOEOF 0x10
- #define _IOERR 0x20
- #define _IORW 0x100
-
- #define EOF (-1)
-
- /* defines for fseek() */
- #define SEEK_SET 0
- #define SEEK_CUR 1
- #define SEEK_END 2
-
- extern FILE *stdin;
- extern FILE *stdout;
- extern FILE *stderr;
-
- /* the functions ... */
-
- /* B1.1 */
-
- FILE *fopen(const char *filename, const char *mode);
- FILE *freopen(const char *filename, const char *mode, FILE *stream);
- int fflush(FILE *stream);
- int fclose(FILE *stream);
- #ifndef __SYSTEM_H__
- #include <system.h>
- #endif
- #define remove(fileName) unlink(fileName)
- int rename(const char *oldname, const char *newname);
- FILE *tmpfile(void);
- char *tmpnam(char *s);
- #if 0
- int setvbuf(FILE *stream, char *buf, int mode, size_t size);
- void setbuf(FILE *stream, char *buf);
- #endif
-
- /* B1.2 */
-
- int fprintf(FILE *stream, const char *format, ...);
- int printf(const char *format, ...);
- int sprintf(char *s, const char *format, ...);
- int vfprintf(FILE *stream, const char *format, va_list arg);
- int vprintf(const char *format, va_list arg);
- int vsprintf(char *s, const char *format, va_list arg);
-
- /* B1.3 */
-
- int fscanf(FILE *stream, const char *format, ...);
- int scanf(const char *format, ...);
- int sscanf(const char *s, const char *format, ...);
-
- /* B1.4 */
- int fgetc(FILE *stream);
- char *fgets(char *s, int n, FILE *stream);
- int fputc(int c, FILE *stream);
- int fputs(const char *s, FILE *stream);
- #define getc(c) fgetc((c))
- #define getchar() fgetc(stdin)
- #if 0
- char *gets(char *s);
- #endif
- #define putc(c,s) fputc((c),(s))
- #define putchar(c) fputc((c), stdout)
- int puts(const char *s);
- int ungetc(int c, FILE *stream);
-
- /* B1.5 */
- size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream);
- size_t fwrite(const void *ptr, size_t size, size_t nobj, FILE *stream);
-
- /* B1.6 */
-
- int fseek(FILE *stream, long offset, int origin);
- long ftell(FILE *stream);
- void rewind(FILE *stream);
- #if 0
- int fgetpos(FILE *stream, long *ptr); /* _nb_ not fpos_t */
- int fsetpos(FILE *stream, const long *ptr);
- #endif
-
- /* B1.7 */
-
- #define clearerr(p) ((p)->_fileflag &= ~(_FILEBAD|_FILEATEOF))
- #define feof(p) (((p)->_fileflag&_FILEATEOF)!=0)
- #define ferror(p) (((p)->_fileflag&_FILEBAD)!=0)
- void perror(const char *s);
-
- /* extras */
-
- FILE *fdopen(int desc, const char *mode);
- #define fileno(p) ((p)->_fileunit)
-
- #endif /* __STDIO_H__ */
-
-